package cn.com.adcc.utils;

import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.util.Zip4jConstants;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

import java.io.File;

/**
 * Created by anzilu on 2015/10/27.
 */
public class Zip4Java {

    public static void main(String[] args){

        String source="D:\\MSVS2013";
        String destination="D:\\MSVS2013.zip";
        try {


            DateTime startcomp = new DateTime(DateTimeZone.UTC);

            ZipFile zipFile2 = new ZipFile(destination);
            ZipParameters parameters1=new ZipParameters();
            parameters1.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
            parameters1.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_FASTEST);
            zipFile2.addFile(new File(source),parameters1);


        }
        catch (ZipException e) {

        }


    }


}
